package news.dao;

import news.pojo.Category;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class CategoryDao {
    /**
     * 获取所有的分类数据
     *
     * @return
     * @throws SQLException
     */
    public List<Category> selectAll() throws SQLException {
        String sql = "select * from news_cate order by sort desc";
        return DBTool.getQueryRunner().query(sql, new BeanListHandler<Category>(Category.class));
    }
}
